%%% -*- coding: utf-8 -*-
-module(run).
-author("cmj").

%% API
-export([
    case5/0,
    case4/0,
    case3/0,
    case2/0,
    case1/0
]).

case1() ->
    {ok, State} = erlua:newstate(),
    {ok, nil} = erlua:load_luafile(State, "./mod1.lua"),
    {ok, nil} = erlua:load_luafile(State, 'mod1.lua'),
    {ok, nil} = erlua:load_luafile(State, <<"./mod1.lua">>),
    {exception, _, cannot_open} = erlua:load_luafile(State, 'not_exist.lua'),
    {exception, _} = erlua:load_luafile(State, 1212),
    {exception, _, not_lua_state} = erlua:load_luafile(what_ever, "./mod1.lua"),
    {exception, _, not_lua_state} = erlua:load_luafile(1212, "./mod1.lua"),
    ok.

case2() ->
    {ok, State} = erlua:newstate(),
    {ok, nil} = erlua:load_luafile(State, "./mod1.lua"),
    {ok, _} = erlua:memory_use(State),
    {error, not_lua_state} = erlua:memory_use(a_atom),
    {error, not_lua_state} = erlua:memory_use(1221),
    ok = erlua:gc(State),
    {error, not_lua_state} = erlua:gc(erlang:make_ref()),
    {error, not_lua_state} = erlua:gc(1221),
    ok.

case3() ->
    {ok, State} = erlua:newstate(),
    {ok, {"ok", [{1, 1}, {2, 2}, {3, 3}, {4, 4}], 6769}} = erlua:load_luafile(State, "./mod2.lua"),
    {ok, _} = erlua:load_luafile(State, "./mod1.lua"),
    {exception, _} = erlua:func(State, not_exist_func),
    {exception, _} = erlua:func_ls(State, not_exist_func, [111]),
    "a string" = erlua:func(State, no_params_func_str),
    "a string" = erlua:func_ls(State, "no_params_func_str", []),
    12134 = erlua:func(State, no_params_func_int),
    12134 = erlua:func_ls(State, no_params_func_int, []),
    Func = fun() -> ok end,
    {exception,"erlang func not support!"} = erlua:func(State, ret_self, Func),
    {exception,"Reference not support!"} = erlua:func(State, ret_self, State),
    {exception,"third param not a list"} = erlua:func_ls(State, ret_self, 123),
    {exception, _} = erlua:func(State, ret_func),
    {nil, true, false} = erlua:func(State, "no_params_func_ret_mul"),
    2333 = erlua:func(State, ret_self, 2333),
    2333 = erlua:func_ls(State, ret_self, [2333]),
    68 = erlua:func(State, add_func, 12, 56),
    true = (68.7 =:= erlua:func(State, add_func, 12.5, 56.2)),
    68 = erlua:func_ls(State, add_func, [12, 56]),
    43 = erlua:func_ls(State, sub_func, [99, 56]),
    -602 = erlua:func_ls(State, sub_func, [13, 615]),
    "a_atom" = erlua:func(State, ret_self, a_atom),
    [{1,97},{2,95},{3,115},{4,116},{5,114},{6,105},{7,110},{8,103}] = erlua:func(State, ret_self, "a_string"),
    "a_bin_string" = erlua:func(State, ret_self, <<"a_bin_string">>),
    {Time1, 68} = timer:tc(erlua, func, [State, add_func, 12, 56]),
    io:format("add_func spend time:~w us~n", [Time1]),
    {Time2, 68} = timer:tc(erlua, func_ls, [State, add_func, [12, 56]]),
    io:format("add_func spend time:~w us~n", [Time2]),
    [{1,1},{2,2},{3,3},{4,4},{5,5}] = erlua:func(State, ret_self, [1,2,3,4,5]),
    Ls1 = [{1, 10}, {2, 20}, {3, 30}, {4, 40}, {5, 50}],
    ExpectRet1 = [
        {1,[{1,1},{2,10}]},
        {2,[{1,2},{2,20}]},
        {3,[{1,3},{2,30}]},
        {4,[{1,4},{2,40}]},
        {5,[{1,5},{2,50}]}
    ],
    ExpectRet1 = erlua:func(State, ret_self, Ls1),
    {Time3, ExpectRet1} = timer:tc(erlua, func, [State, ret_self, Ls1]),
    io:format("ret_self spend time:~w us~n", [Time3]),
    ok.

case4() ->
    {ok, State} = erlua:newstate(),
    {ok, nil} = erlua:load_luafile(State, "./mod3.lua"),
    {Time1, _} = timer:tc(erlua, func, [State, "ret_big_table1"]),
    io:format("ret_big_table1 spend time:~w us~n", [Time1]),
    {Time2, _} = timer:tc(erlua, func, [State, "ret_global_big_table1"]),
    io:format("ret_global_big_table1 spend time:~w us~n", [Time2]),
    ok.

case5() ->
    {ok, State} = erlua:newstate(),
    {ok, nil} = erlua:load_luafile(State, "./mod1.lua"),
    BigLs = [{"map_info", [{"actor_buff_list", [{1, [{"add_type", 2}, {"value", 4020}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1001}]}, {2, [{"add_type", 2}, {"value", 4020}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {3, [{"add_type", 2}, {"value", 3990}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {4, [{"add_type", 2}, {"value", 16790}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1021}]}, {5, [{"add_type", 2}, {"value", 134760}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1001}]}, {6, [{"add_type", 2}, {"value", 6500}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1023}]}, {7, [{"add_type", 2}, {"value", 96780}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {8, [{"add_type", 2}, {"value", 105540}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {9, [{"add_type", 2}, {"value", 5050}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1024}]}, {10, [{"add_type", 2}, {"value", 105180}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {11, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1001}]}, {12, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1006}]}, {13, [{"add_type", 2}, {"value", 3600}, {"effect_soldier_ls", [{1, 302007}]}, {"buff_type", 1001}]}, {14, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302007}]}, {"buff_type", 1004}]}, {15, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1004}]}, {16, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1001}]}, {17, [{"add_type", 2}, {"value", 2400}, {"effect_soldier_ls", [{1, 302005}]}, {"buff_type", 1004}]}, {18, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302005}]}, {"buff_type", 1001}]}, {19, [{"add_type", 2}, {"value", 2700}, {"effect_soldier_ls", [{1, 302004}]}, {"buff_type", 1004}]}, {20, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302004}]}, {"buff_type", 1001}]}, {21, [{"add_type", 2}, {"value", 1500}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1004}]}, {22, [{"add_type", 2}, {"value", 1500}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1001}]}, {23, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1004}]}, {24, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1001}]}, {25, [{"add_type", 2}, {"value", 10900}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1011}]}, {26, [{"add_type", 2}, {"value", 2000}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1027}]}, {27, [{"add_type", 2}, {"effect_group_index_ls", [{1, 202}]}, {"value", 4760}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301037}]}]}, {28, [{"add_type", 2}, {"value", 900}, {"effect_general_ls", [{1, 301037}]}, {"buff_type", 1001}]}, {29, [{"add_type", 2}, {"value", 900}, {"effect_general_ls", [{1, 301037}]}, {"buff_type", 1023}]}, {30, [{"add_type", 2}, {"value", 1606}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {31, [{"add_type", 2}, {"value", 1606}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {32, [{"add_type", 2}, {"effect_group_index_ls", [{1, 202}]}, {"value", 5672}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301037}]}]}, {33, [{"add_type", 2}, {"effect_group_index_ls", [{1, 202}]}, {"value", 2460}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301037}]}]}, {34, [{"add_type", 2}, {"value", 1800}, {"effect_general_ls", [{1, 301011}]}, {"buff_type", 1001}]}, {35, [{"add_type", 2}, {"value", 900}, {"effect_general_ls", [{1, 301011}]}, {"buff_type", 1023}]}, {36, [{"add_type", 2}, {"effect_group_index_ls", [{1, 205}]}, {"value", 3260}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301011}]}]}, {37, [{"add_type", 2}, {"value", 1606}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {38, [{"add_type", 2}, {"value", 1606}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {39, [{"add_type", 2}, {"effect_group_index_ls", [{1, 205}]}, {"value", 2460}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301011}]}]}, {40, [{"add_type", 2}, {"effect_group_index_ls", [{1, 205}]}, {"value", 2460}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301011}]}]}, {41, [{"add_type", 2}, {"effect_group_index_ls", [{1, 204}]}, {"value", 15990}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301042}]}]}, {42, [{"add_type", 2}, {"value", 1500}, {"effect_general_ls", [{1, 301042}]}, {"buff_type", 1001}]}, {43, [{"add_type", 2}, {"value", 1606}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {44, [{"add_type", 2}, {"value", 1606}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {45, [{"add_type", 2}, {"effect_group_index_ls", [{1, 204}]}, {"value", 2460}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301042}]}]}, {46, [{"add_type", 2}, {"effect_group_index_ls", [{1, 204}]}, {"value", 2460}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301042}]}]}, {47, [{"add_type", 2}, {"effect_group_index_ls", [{1, 201}]}, {"value", 5180}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301017}]}]}, {48, [{"add_type", 2}, {"effect_group_index_ls", [{1, 201}]}, {"value", 3810}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1006}, {"effect_general_ls", [{1, 301017}]}]}, {49, [{"add_type", 2}, {"value", 1200}, {"effect_general_ls", [{1, 301017}]}, {"buff_type", 1006}]}, {50, [{"add_type", 2}, {"value", 1305}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {51, [{"add_type", 2}, {"value", 1305}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}]}, {"dungeons_id", 2103}, {"atk_extra_list", [{1, [{"extra", 0}, {"key", 1}, {"value", 285383660}]}, {2, [{"extra", 0}, {"key", 3}, {"value", 9}]}, {3, [{"extra", 0}, {"key", 16}, {"value", 164794096}]}, {4, [{"extra", 0}, {"key", 17}, {"value", 75304587}]}, {5, [{"extra", 19}, {"key", 4}, {"value", 7011}]}, {6, [{"extra", 20}, {"key", 5}, {"value", 7002}]}, {7, [{"extra", 20}, {"key", 5}, {"value", 7003}]}, {8, [{"extra", 10}, {"key", 6}, {"value", 300101}]}, {9, [{"extra", 3}, {"key", 10}, {"value", 30200405}]}, {10, [{"extra", 4}, {"key", 10}, {"value", 30200705}]}, {11, [{"extra", 5}, {"key", 10}, {"value", 30200805}]}, {12, [{"extra", 4}, {"key", 10}, {"value", 30200605}]}, {13, [{"extra", 5}, {"key", 10}, {"value", 30200704}]}, {14, [{"extra", 5}, {"key", 10}, {"value", 30200404}]}, {15, [{"extra", 5}, {"key", 10}, {"value", 30200804}]}, {16, [{"extra", 5}, {"key", 10}, {"value", 30200803}]}, {17, [{"extra", 5}, {"key", 10}, {"value", 30200802}]}, {18, [{"extra", 5}, {"key", 10}, {"value", 30200801}]}, {19, [{"extra", 5}, {"key", 10}, {"value", 30200604}]}, {20, [{"extra", 5}, {"key", 10}, {"value", 30200403}]}, {21, [{"extra", 5}, {"key", 10}, {"value", 30200402}]}, {22, [{"extra", 5}, {"key", 10}, {"value", 30200401}]}, {23, [{"extra", 5}, {"key", 10}, {"value", 30200603}]}, {24, [{"extra", 5}, {"key", 10}, {"value", 30200703}]}, {25, [{"extra", 5}, {"key", 10}, {"value", 30200702}]}, {26, [{"extra", 5}, {"key", 10}, {"value", 30200701}]}, {27, [{"extra", 5}, {"key", 10}, {"value", 30200602}]}, {28, [{"extra", 5}, {"key", 10}, {"value", 30200507}]}, {29, [{"extra", 5}, {"key", 10}, {"value", 30200207}]}, {30, [{"extra", 5}, {"key", 10}, {"value", 30200108}]}, {31, [{"extra", 5}, {"key", 10}, {"value", 30200506}]}, {32, [{"extra", 5}, {"key", 10}, {"value", 30200107}]}, {33, [{"extra", 5}, {"key", 10}, {"value", 30200206}]}, {34, [{"extra", 5}, {"key", 10}, {"value", 30200106}]}, {35, [{"extra", 5}, {"key", 10}, {"value", 30200505}]}, {36, [{"extra", 5}, {"key", 10}, {"value", 30200205}]}, {37, [{"extra", 5}, {"key", 10}, {"value", 30200105}]}, {38, [{"extra", 5}, {"key", 10}, {"value", 30200504}]}, {39, [{"extra", 5}, {"key", 10}, {"value", 30200503}]}, {40, [{"extra", 5}, {"key", 10}, {"value", 30200502}]}, {41, [{"extra", 5}, {"key", 10}, {"value", 30200204}]}, {42, [{"extra", 5}, {"key", 10}, {"value", 30200501}]}, {43, [{"extra", 5}, {"key", 10}, {"value", 30200601}]}, {44, [{"extra", 5}, {"key", 10}, {"value", 30200203}]}, {45, [{"extra", 5}, {"key", 10}, {"value", 30200104}]}, {46, [{"extra", 5}, {"key", 10}, {"value", 30200202}]}, {47, [{"extra", 5}, {"key", 10}, {"value", 30200201}]}, {48, [{"extra", 5}, {"key", 10}, {"value", 30200103}]}, {49, [{"extra", 5}, {"key", 10}, {"value", 30200102}]}, {50, [{"extra", 5}, {"key", 10}, {"value", 30200101}]}]}, {"team_buff_list", [{1, [{"add_type", 2}, {"value", 2880}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1001}]}, {2, [{"add_type", 2}, {"value", 2880}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {3, [{"add_type", 2}, {"value", 2850}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {4, [{"add_type", 2}, {"value", 12700}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1021}]}, {5, [{"add_type", 2}, {"value", 122960}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1001}]}, {6, [{"add_type", 2}, {"value", 7250}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1023}]}, {7, [{"add_type", 2}, {"value", 86820}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {8, [{"add_type", 2}, {"value", 91820}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {9, [{"add_type", 2}, {"value", 7500}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1024}]}, {10, [{"add_type", 2}, {"value", 96460}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {11, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1001}]}, {12, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1006}]}, {13, [{"add_type", 2}, {"value", 2700}, {"effect_soldier_ls", [{1, 302007}]}, {"buff_type", 1004}]}, {14, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302007}]}, {"buff_type", 1001}]}, {15, [{"add_type", 2}, {"value", 2700}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1004}]}, {16, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1001}]}, {17, [{"add_type", 2}, {"value", 4500}, {"effect_soldier_ls", [{1, 302005}]}, {"buff_type", 1001}]}, {18, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302005}]}, {"buff_type", 1004}]}, {19, [{"add_type", 2}, {"value", 2400}, {"effect_soldier_ls", [{1, 302004}]}, {"buff_type", 1004}]}, {20, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302004}]}, {"buff_type", 1001}]}, {21, [{"add_type", 2}, {"value", 4500}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1001}]}, {22, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1004}]}, {23, [{"add_type", 2}, {"value", 7000}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1001}]}, {24, [{"add_type", 2}, {"value", 3000}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1004}]}, {25, [{"add_type", 2}, {"value", 6800}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1011}]}, {26, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 24744}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301005}]}]}, {27, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 17900}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301005}]}]}, {28, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 2900}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301005}]}]}, {29, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 2900}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301005}]}]}, {30, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 5500}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301005}]}]}, {31, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 4600}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1001}]}, {32, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 1200}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1004}]}, {33, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {34, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {35, [{"add_type", 2}, {"effect_group_index_ls", [{1, 102}]}, {"value", 8372}, {"effect_soldier_ls", [{1, 302002}]}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301005}]}]}, {36, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {37, [{"add_type", 2}, {"effect_group_index_ls", [{1, 105}]}, {"value", 18544}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1006}, {"effect_general_ls", [{1, 301041}]}]}, {38, [{"add_type", 2}, {"effect_group_index_ls", [{1, 105}]}, {"value", 18512}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301041}]}]}, {39, [{"add_type", 2}, {"effect_group_index_ls", [{1, 105}]}, {"value", 6700}, {"buff_type", 1006}, {"effect_general_ls", [{1, 301041}]}]}, {40, [{"add_type", 2}, {"effect_group_index_ls", [{1, 105}]}, {"value", 5600}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301041}]}]}, {41, [{"add_type", 2}, {"effect_group_index_ls", [{1, 105}]}, {"value", 5200}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1001}]}, {42, [{"add_type", 2}, {"effect_group_index_ls", [{1, 105}]}, {"value", 6400}, {"effect_soldier_ls", [{1, 302008}]}, {"buff_type", 1006}]}, {43, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {44, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1001}]}, {45, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {46, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 39958}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301011}]}]}, {47, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 31718}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301011}]}]}, {48, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 6060}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301011}]}]}, {49, [{"add_type", 2}, {"value", 1800}, {"effect_general_ls", [{1, 301011}]}, {"buff_type", 1023}]}, {50, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 5200}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301011}]}]}, {51, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 1440}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1004}]}, {52, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 3120}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1001}]}, {53, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 5200}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301011}]}]}, {54, [{"add_type", 2}, {"value", 3622}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {55, [{"add_type", 2}, {"value", 3622}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1022}]}, {56, [{"add_type", 2}, {"value", 3622}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {57, [{"add_type", 2}, {"value", 3622}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1001}]}, {58, [{"add_type", 2}, {"effect_group_index_ls", [{1, 107}]}, {"value", 10200}, {"effect_soldier_ls", [{1, 302006}]}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301011}]}]}, {59, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 14052}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301002}]}]}, {60, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 25114}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301002}]}]}, {61, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 7040}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301002}]}]}, {62, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 5080}, {"buff_type", 1001}, {"effect_general_ls", [{1, 301002}]}]}, {63, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 6260}, {"buff_type", 1004}, {"effect_general_ls", [{1, 301002}]}]}, {64, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 4160}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1001}]}, {65, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 1920}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1004}]}, {66, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1001}]}, {67, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1004}]}, {68, [{"add_type", 2}, {"value", 2146}, {"effect_soldier_ls", [{1, 1}]}, {"effect_general_ls", [{1, 1}]}, {"buff_type", 1006}]}, {69, [{"add_type", 2}, {"effect_group_index_ls", [{1, 101}]}, {"value", 4080}, {"effect_soldier_ls", [{1, 302001}]}, {"buff_type", 1022}, {"effect_general_ls", [{1, 301002}]}]}]}, {"pvp_actor_list", [{4, [{"group_index", 5}, {"soldiers", [{"num", 3}, {"type_id", 302006}, {"level", 100}, {"id", 49}, {"hp_list", [{1, 272828}, {2, 272828}, {3, 272828}]}]}, {"general_info", [{"skill_list", [{1, [{"value", 100}, {"key", 2006}]}, {2, [{"value", 1}, {"key", 4411}]}, {3, [{"value", 2}, {"key", 4311}]}, {4, [{"value", 2}, {"key", 4011}]}, {5, [{"value", 2}, {"key", 3011}]}]}, {"type_id", 301011}, {"level", 100}, {"extra_attr", [{1, [{"value", 147127}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 3}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 5}, {"key", 5}]}]}, {"id", 48}]}]}, {1, [{"group_index", 1}, {"soldiers", [{"num", 6}, {"type_id", 302008}, {"level", 50}, {"id", 31}, {"hp_list", [{1, 75892}, {2, 75892}, {3, 75892}, {4, 75892}, {5, 75892}, {6, 75892}]}]}, {"general_info", [{"skill_list", [{4, [{"value", 1}, {"key", 3017}]}, {1, [{"value", 50}, {"key", 2008}]}, {2, [{"value", 1}, {"key", 4317}]}, {3, [{"value", 1}, {"key", 4017}]}]}, {"type_id", 301017}, {"level", 50}, {"extra_attr", [{1, [{"value", 72670}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 3}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 4}, {"key", 5}]}]}, {"id", 30}]}]}, {2, [{"group_index", 2}, {"soldiers", [{"num", 3}, {"type_id", 302006}, {"level", 100}, {"id", 38}, {"hp_list", [{1, 275511}, {2, 275511}, {3, 275511}]}]}, {"general_info", [{"skill_list", [{1, [{"value", 100}, {"key", 2006}]}, {2, [{"value", 1}, {"key", 4437}]}, {3, [{"value", 2}, {"key", 4337}]}, {4, [{"value", 2}, {"key", 4037}]}, {5, [{"value", 2}, {"key", 3037}]}]}, {"type_id", 301037}, {"level", 100}, {"extra_attr", [{1, [{"value", 147684}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 3}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 5}, {"key", 5}]}]}, {"id", 37}]}]}, {3, [{"group_index", 4}, {"soldiers", [{"num", 6}, {"type_id", 302002}, {"level", 100}, {"id", 42}, {"hp_list", [{1, 195223}, {2, 195223}, {3, 195223}, {4, 195223}, {5, 195223}, {6, 195223}]}]}, {"general_info", [{"skill_list", [{1, [{"value", 100}, {"key", 2002}]}, {2, [{"value", 1}, {"key", 4442}]}, {3, [{"value", 2}, {"key", 4342}]}, {4, [{"value", 2}, {"key", 4042}]}, {5, [{"value", 2}, {"key", 3042}]}]}, {"type_id", 301042}, {"level", 100}, {"extra_attr", [{1, [{"value", 250255}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 5}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 6}, {"key", 5}]}]}, {"id", 41}]}]}]}, {"map_id", 2103}, {"team_list", [{4, [{"group_index", 7}, {"soldiers", [{"num", 3}, {"type_id", 302006}, {"level", 100}, {"id", 27}, {"hp_list", [{1, 321469}, {2, 321469}, {3, 321469}]}]}, {"general_info", [{"skill_list", [{8, [{"value", 1}, {"key", 6701}]}, {1, [{"value", 100}, {"key", 2006}]}, {2, [{"value", 1}, {"key", 4411}]}, {3, [{"value", 2}, {"key", 4311}]}, {4, [{"value", 2}, {"key", 4011}]}, {5, [{"value", 2}, {"key", 3011}]}, {6, [{"value", 1}, {"key", 6703}]}, {7, [{"value", 1}, {"key", 6702}]}]}, {"type_id", 301011}, {"level", 100}, {"extra_attr", [{1, [{"value", 229374}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 7}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 6}, {"key", 5}]}]}, {"id", 26}]}]}, {1, [{"group_index", 1}, {"soldiers", [{"num", 10}, {"type_id", 302001}, {"level", 100}, {"id", 2}, {"hp_list", [{1, 96376}, {2, 96376}, {3, 96376}, {4, 96376}, {5, 96376}, {6, 96376}, {7, 96376}, {8, 96376}, {9, 96376}, {10, 96376}]}]}, {"general_info", [{"skill_list", [{8, [{"value", 1}, {"key", 6101}]}, {1, [{"value", 100}, {"key", 2001}]}, {2, [{"value", 1}, {"key", 4402}]}, {3, [{"value", 2}, {"key", 4302}]}, {4, [{"value", 2}, {"key", 4002}]}, {5, [{"value", 2}, {"key", 3002}]}, {6, [{"value", 1}, {"key", 6103}]}, {7, [{"value", 1}, {"key", 6102}]}]}, {"type_id", 301002}, {"level", 100}, {"extra_attr", [{1, [{"value", 227899}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 8}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 6}, {"key", 5}]}]}, {"id", 1}]}]}, {2, [{"group_index", 2}, {"soldiers", [{"num", 6}, {"type_id", 302002}, {"level", 110}, {"id", 13}, {"hp_list", [{1, 228487}, {2, 228487}, {3, 228487}, {4, 228487}, {5, 228487}, {6, 228487}]}]}, {"general_info", [{"skill_list", [{1, [{"value", 110}, {"key", 2002}]}, {2, [{"value", 2}, {"key", 4405}]}, {3, [{"value", 2}, {"key", 3005}]}, {4, [{"value", 2}, {"key", 4305}]}, {5, [{"value", 2}, {"key", 4005}]}, {6, [{"value", 1}, {"key", 6402}]}, {7, [{"value", 1}, {"key", 6401}]}]}, {"type_id", 301005}, {"level", 110}, {"extra_attr", [{1, [{"value", 312143}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 9}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 6}, {"key", 5}]}]}, {"id", 12}]}]}, {3, [{"group_index", 5}, {"soldiers", [{"num", 6}, {"type_id", 302008}, {"level", 100}, {"id", 20}, {"hp_list", [{1, 151542}, {2, 151542}, {3, 151542}, {4, 151542}, {5, 151542}, {6, 151542}]}]}, {"general_info", [{"skill_list", [{8, [{"value", 1}, {"key", 6601}]}, {1, [{"value", 100}, {"key", 2008}]}, {2, [{"value", 1}, {"key", 4441}]}, {3, [{"value", 2}, {"key", 4341}]}, {4, [{"value", 2}, {"key", 4041}]}, {5, [{"value", 2}, {"key", 3041}]}, {6, [{"value", 1}, {"key", 6603}]}, {7, [{"value", 1}, {"key", 6602}]}]}, {"type_id", 301041}, {"level", 100}, {"extra_attr", [{1, [{"value", 192862}, {"key", 1}]}, {2, [{"value", 0}, {"key", 2}]}, {3, [{"value", 7}, {"key", 3}]}, {4, [{"value", 0}, {"key", 4}]}, {5, [{"value", 6}, {"key", 5}]}]}, {"id", 19}]}]}]}, {"map_index", 10000252}, {"def_extra_list", [{1, [{"extra", 0}, {"key", 1}, {"value", 187019754}]}, {2, [{"extra", 0}, {"key", 3}, {"value", 8}]}, {3, [{"extra", 0}, {"key", 16}, {"value", 117256540}]}, {4, [{"extra", 0}, {"key", 17}, {"value", 69309413}]}, {5, [{"extra", 12}, {"key", 4}, {"value", 7012}]}, {6, [{"extra", 16}, {"key", 5}, {"value", 7002}]}, {7, [{"extra", 18}, {"key", 5}, {"value", 7003}]}, {8, [{"extra", 11}, {"key", 6}, {"value", 300201}]}, {9, [{"extra", 3}, {"key", 10}, {"value", 30200505}]}, {10, [{"extra", 5}, {"key", 10}, {"value", 30200504}]}, {11, [{"extra", 5}, {"key", 10}, {"value", 30200503}]}, {12, [{"extra", 2}, {"key", 10}, {"value", 30200707}]}, {13, [{"extra", 5}, {"key", 10}, {"value", 30200706}]}, {14, [{"extra", 3}, {"key", 10}, {"value", 30200106}]}, {15, [{"extra", 5}, {"key", 10}, {"value", 30200105}]}, {16, [{"extra", 4}, {"key", 10}, {"value", 30200405}]}, {17, [{"extra", 5}, {"key", 10}, {"value", 30200404}]}, {18, [{"extra", 5}, {"key", 10}, {"value", 30200403}]}, {19, [{"extra", 5}, {"key", 10}, {"value", 30200402}]}, {20, [{"extra", 5}, {"key", 10}, {"value", 30200104}]}, {21, [{"extra", 5}, {"key", 10}, {"value", 30200103}]}, {22, [{"extra", 5}, {"key", 10}, {"value", 30200705}]}, {23, [{"extra", 5}, {"key", 10}, {"value", 30200606}]}, {24, [{"extra", 5}, {"key", 10}, {"value", 30200805}]}, {25, [{"extra", 5}, {"key", 10}, {"value", 30200605}]}, {26, [{"extra", 5}, {"key", 10}, {"value", 30200604}]}, {27, [{"extra", 4}, {"key", 10}, {"value", 30200203}]}, {28, [{"extra", 5}, {"key", 10}, {"value", 30200603}]}, {29, [{"extra", 5}, {"key", 10}, {"value", 30200602}]}, {30, [{"extra", 5}, {"key", 10}, {"value", 30200502}]}, {31, [{"extra", 5}, {"key", 10}, {"value", 30200102}]}, {32, [{"extra", 5}, {"key", 10}, {"value", 30200202}]}, {33, [{"extra", 5}, {"key", 10}, {"value", 30200601}]}, {34, [{"extra", 5}, {"key", 10}, {"value", 30200401}]}, {35, [{"extra", 5}, {"key", 10}, {"value", 30200501}]}, {36, [{"extra", 5}, {"key", 10}, {"value", 30200101}]}, {37, [{"extra", 5}, {"key", 10}, {"value", 30200804}]}, {38, [{"extra", 5}, {"key", 10}, {"value", 30200803}]}, {39, [{"extra", 5}, {"key", 10}, {"value", 30200802}]}, {40, [{"extra", 5}, {"key", 10}, {"value", 30200801}]}, {41, [{"extra", 5}, {"key", 10}, {"value", 30200704}]}, {42, [{"extra", 5}, {"key", 10}, {"value", 30200703}]}, {43, [{"extra", 5}, {"key", 10}, {"value", 30200702}]}, {44, [{"extra", 5}, {"key", 10}, {"value", 30200701}]}, {45, [{"extra", 5}, {"key", 10}, {"value", 30200201}]}]}, {"random_seed", 1565429053}]},
    {"dest_name", "cmj"}],
    {Time1, _} = timer:tc(erlua, func, [State, ret_self, BigLs]),
    io:format("ret_self big spend time1:~w us~n", [Time1]),
    {Time2, _} = timer:tc(erlua, func, [State, ret_self, BigLs]),
    io:format("ret_self big spend time2:~w us~n", [Time2]),
    {Time3, _} = timer:tc(erlua, func_ls, [State, ret_self_ls, BigLs]),
    io:format("ret_self_ls big spend time2:~w us~n", [Time3]),
    {Time4, _} = timer:tc(erlua, func_ls, [State, ret_self_ls, BigLs]),
    io:format("ret_self_ls big spend time2:~w us~n", [Time4]),
    ok.
